<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for javascripts/modules/utils.js</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="../../prettify.css" />
    <link rel="stylesheet" href="../../base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type='text/css'>
        .coverage-summary .sorter {
            background-image: url(../../sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class='wrapper'>
  <div class='pad1'>
    <h1>
      <a href="../../index.html">All files</a> / <a href="index.html">javascripts/modules</a> utils.js
    </h1>
    <div class='clearfix'>
      <div class='fl pad1y space-right2'>
        <span class="strong">21.84% </span>
        <span class="quiet">Statements</span>
        <span class='fraction'>19/87</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Branches</span>
        <span class='fraction'>0/36</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">33.33% </span>
        <span class="quiet">Functions</span>
        <span class='fraction'>12/36</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">20.48% </span>
        <span class="quiet">Lines</span>
        <span class='fraction'>17/83</span>
      </div>
    </div>
  </div>
  <div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">100x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">158x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">/* eslint camelcase: 0 */
const d3 = require('d3');
const $ = require('jquery');
&nbsp;
/*
  Utility function that takes a d3 svg:text selection and a max width, and splits the
  text's text across multiple tspan lines such that any given line does not exceed max width
&nbsp;
  If text does not span multiple lines AND adjustedY is passed,
  will set the text to the passed val
*/
export f</span>unction <span class="fstat-no" title="function not covered" >wrapSvgText(text, width, adjustedY) {
  c</span>onst lineHeight = <span class="cstat-no" title="statement not covered" >1;
  // ems
<span class="cstat-no" title="statement not covered" >  text.each(<span class="fstat-no" title="function not covered" >function () </span>{</span>
    c</span>onst d3Text = <span class="cstat-no" title="statement not covered" >d3.select(this);
    c</span>onst words = <span class="cstat-no" title="statement not covered" >d3Text.text().split(/\s+/);
    l</span>et <span class="cstat-no" title="statement not covered" >word;
    l</span>et line = <span class="cstat-no" title="statement not covered" >[];
    l</span>et lineNumber = <span class="cstat-no" title="statement not covered" >0;
    c</span>onst x = <span class="cstat-no" title="statement not covered" >d3Text.attr('x');
    c</span>onst y = <span class="cstat-no" title="statement not covered" >d3Text.attr('y');
    c</span>onst dy = <span class="cstat-no" title="statement not covered" >parseFloat(d3Text.attr('dy'));
    let tspan =
<span class="cstat-no" title="statement not covered" >      d3Text.text(null).append('tspan').attr('x', x)</span>
            .attr('y', y)
            .attr('dy', dy + 'em');
&nbsp;
    l</span>et didWrap = <span class="cstat-no" title="statement not covered" >false;
<span class="cstat-no" title="statement not covered" >    for (let i = 0; i &lt; words.length; i++) {</span>
<span class="cstat-no" title="statement not covered" >      word = words[i];</span>
<span class="cstat-no" title="statement not covered" >      line.push(word);</span>
<span class="cstat-no" title="statement not covered" >      tspan.text(line.join(' '));</span>
<span class="cstat-no" title="statement not covered" >      if (tspan.node().getComputedTextLength() &gt; width) {</span>
<span class="cstat-no" title="statement not covered" >        line.pop();</span>
        // remove word that pushes over the limit
<span class="cstat-no" title="statement not covered" >        tspan.text(line.join(' '));</span>
<span class="cstat-no" title="statement not covered" >        line = [word];</span>
<span class="cstat-no" title="statement not covered" >        tspan =</span>
          d3Text.append('tspan').attr('x', x).attr('y', y)
                .attr('dy', ++lineNumber * lineHeight + dy + 'em')
                .text(word);
<span class="cstat-no" title="statement not covered" >        didWrap = true;</span>
      }
    }
<span class="cstat-no" title="statement not covered" >    if (!didWrap &amp;&amp; typeof adjustedY !== 'undefined') {</span>
<span class="cstat-no" title="statement not covered" >      tspan.attr('y', adjustedY);</span>
    }
  });
}
&nbsp;
/**
 * Sets the body and title content of a modal, and shows it. Assumes HTML for modal exists and that
 * it handles closing (i.e., works with bootstrap)
 *
 * @param {object} options object of the form
 *  {
 *    title: {string},
 *    body: {string},
 *    modalSelector: {string, default: '.misc-modal' },
 *    titleSelector: {string, default: '.misc-modal .modal-title' },
 *    bodySelector:  {string, default: '.misc-modal .modal-body' },
 *   }
 */
export f</span>unction <span class="fstat-no" title="function not covered" >showModal(options) {
  /* eslint no-param-reassign: 0 */
<span class="cstat-no" title="statement not covered" >  options.modalSelector = options.modalSelector || '.misc-modal';</span>
<span class="cstat-no" title="statement not covered" >  options.titleSelector = options.titleSelector || '.misc-modal .modal-title';</span>
<span class="cstat-no" title="statement not covered" >  options.bodySelector = options.bodySelector || '.misc-modal .modal-body';</span>
<span class="cstat-no" title="statement not covered" >  $(options.titleSelector).html(options.title || '');</span>
<span class="cstat-no" title="statement not covered" >  $(options.bodySelector).html(options.body || '');</span>
<span class="cstat-no" title="statement not covered" >  $(options.modalSelector).modal('show');</span>
}
&nbsp;
&nbsp;
f</span>unction <span class="fstat-no" title="function not covered" >showApiMessage(resp) {
  const template =
<span class="cstat-no" title="statement not covered" >    '&lt;div class="alert"&gt; ' +</span>
    '&lt;button type="button" class="close" ' +
    'data-dismiss="alert"&gt;\xD7&lt;/button&gt; &lt;/div&gt;';
  c</span>onst severity = <span class="cstat-no" title="statement not covered" >resp.severity || 'info';
<span class="cstat-no" title="statement not covered" >  $(template).addClass('alert-' + severity)</span>
             .append(resp.message)
             .appendTo($('#alert-container'));
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >toggleCheckbox(apiUrlPrefix, selector) {
  c</span>onst apiUrl = <span class="cstat-no" title="statement not covered" >apiUrlPrefix + $(selector)[0].checked;
<span class="cstat-no" title="statement not covered" >  $.get(apiUrl).fail(<span class="fstat-no" title="function not covered" >function (</span>xhr) {</span>
    c</span>onst resp = <span class="cstat-no" title="statement not covered" >xhr.responseJSON;
<span class="cstat-no" title="statement not covered" >    if (resp &amp;&amp; resp.message) {</span>
<span class="cstat-no" title="statement not covered" >      showApiMessage(resp);</span>
    }
  });
}
&nbsp;
/**
 * Fix the height of the table body of a DataTable with scrollY set
 */
export const <span class="fstat-no" title="function not covered" >fixDataTableBodyHeight = f</span>unction ($tableDom, height) {
  c</span>onst headHeight = <span class="cstat-no" title="statement not covered" >$tableDom.find('.dataTables_scrollHead').height();
<span class="cstat-no" title="statement not covered" >  $tableDom.find('.dataTables_scrollBody').css('max-height', height - headHeight);</span>
};
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >d3format(format, number) {
  c</span>onst formatters = <span class="cstat-no" title="statement not covered" >{};
  // Formats a number and memoizes formatters to be reused
<span class="cstat-no" title="statement not covered" >  format = format || '.3s';</span>
<span class="cstat-no" title="statement not covered" >  if (!(format in formatters)) {</span>
<span class="cstat-no" title="statement not covered" >    formatters[format] = d3.format(format);</span>
  }
<span class="cstat-no" title="statement not covered" >  try {</span>
<span class="cstat-no" title="statement not covered" >    return formatters[format](number);</span>
  } catch (e) {
<span class="cstat-no" title="statement not covered" >    return 'ERR';</span>
  }
}
&nbsp;
// Slice objects interact with their context through objects that implement
// this controllerInterface (dashboard, explore, standalone)
export const controllerInterface = {
  type: null,
  done: <span class="fstat-no" title="function not covered" >() =&gt; </span>{},
  error: <span class="fstat-no" title="function not covered" >() =&gt; </span>{},
  always: <span class="fstat-no" title="function not covered" >() =&gt; </span>{},
  addFiler: <span class="fstat-no" title="function not covered" >() =&gt; </span>{},
  setFilter: <span class="fstat-no" title="function not covered" >() =&gt; </span>{},
  getFilters: <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >() =&gt; false,</span></span>
  clearFilter: <span class="fstat-no" title="function not covered" >() =&gt; </span>{},
  removeFilter: <span class="fstat-no" title="function not covered" >() =&gt; </span>{},
  filters: {},
};
&nbsp;
export function formatSelectOptionsForRange(start, end) {
  // outputs array of arrays
  // formatSelectOptionsForRange(1, 5)
  // returns [[1,1], [2,2], [3,3], [4,4], [5,5]]
  const options = [];
  for (let i = start; i &lt;= end; i++) {
    options.push([i, i.toString()]);
  }
  return options;
}
&nbsp;
export function formatSelectOptions(options) {
  return options.map((opt) =&gt;
     [opt, opt.toString()]
  );
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >slugify(string) {
  // slugify('My Neat Label! '); returns 'my-neat-label'
<span class="cstat-no" title="statement not covered" >  return string</span>
          .toString()
          .toLowerCase()
          .trim()
          .replace(/[\s\W-]+/g, '-') // replace spaces, non-word chars, w/ a single dash (-)
          .replace(/-$/, ''); // remove last floating dash
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >getAjaxErrorMsg(error) {
  c</span>onst respJSON = <span class="cstat-no" title="statement not covered" >error.responseJSON;
<span class="cstat-no" title="statement not covered" >  return (respJSON &amp;&amp; respJSON.message) ? respJSON.message :</span>
          error.responseText;
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >customizeToolTip(chart, xAxisFormatter, yAxisFormatters) {
<span class="cstat-no" title="statement not covered" >  chart.useInteractiveGuideline(true);</span>
<span class="cstat-no" title="statement not covered" >  chart.interactiveLayer.tooltip.contentGenerator(<span class="fstat-no" title="function not covered" >function (</span>d) {</span>
    c</span>onst tooltipTitle = <span class="cstat-no" title="statement not covered" >xAxisFormatter(d.value);
    l</span>et tooltip = <span class="cstat-no" title="statement not covered" >'';
&nbsp;
<span class="cstat-no" title="statement not covered" >    tooltip += "&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;td colspan='3'&gt;"</span>
      + `&lt;strong class='x-value'&gt;${tooltipTitle}&lt;/strong&gt;`
      + '&lt;/td&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;';
&nbsp;
<span class="cstat-no" title="statement not covered" >    d.series.forEach(<span class="fstat-no" title="function not covered" >(</span>series, i) =&gt; {</span>
      c</span>onst yAxisFormatter = <span class="cstat-no" title="statement not covered" >yAxisFormatters[i];
      c</span>onst value = <span class="cstat-no" title="statement not covered" >yAxisFormatter(series.value);
<span class="cstat-no" title="statement not covered" >      tooltip += "&lt;tr&gt;&lt;td class='legend-color-guide'&gt;"</span>
        + `&lt;div style="background-color: ${series.color};"&gt;&lt;/div&gt;&lt;/td&gt;`
        + `&lt;td class='key'&gt;${series.key}&lt;/td&gt;`
        + `&lt;td class='value'&gt;${value}&lt;/td&gt;&lt;/tr&gt;`;
    });
&nbsp;
<span class="cstat-no" title="statement not covered" >    tooltip += '&lt;/tbody&gt;&lt;/table&gt;';</span>
&nbsp;
<span class="cstat-no" title="statement not covered" >    return tooltip;</span>
  });
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >initJQueryAjaxCSRF() {
  // Works in conjunction with a Flask-WTF token as described here:
  // http://flask-wtf.readthedocs.io/en/stable/csrf.html#javascript-requests
  c</span>onst token = <span class="cstat-no" title="statement not covered" >$('input#csrf_token').val();
<span class="cstat-no" title="statement not covered" >  if (token) {</span>
<span class="cstat-no" title="statement not covered" >    $.ajaxSetup(<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" ><span class="fstat-no" title="function not covered" >{</span></span></span></span>
      beforeSend(xhr, settings) {
<span class="cstat-no" title="statement not covered" >        if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) &amp;&amp; !this.crossDomain) {</span>
<span class="cstat-no" title="statement not covered" >          xhr.setRequestHeader('X-CSRFToken', token);</span>
        }
      },
    });
  }
}
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
  Code coverage
  generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Apr 11 2017 20:15:55 GMT-0700 (PDT)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>
